Skip to content

refactor(base): Use PossiblyRedactedStateEventContent bound in MinimalStateEvent#6088

Merged
poljar merged 1 commit intomatrix-org:mainfrom
zecakeh:room-info-possibly-redacted
Feb 5, 2026
Merged

refactor(base): Use PossiblyRedactedStateEventContent bound in MinimalStateEvent#6088
poljar merged 1 commit intomatrix-org:mainfrom
zecakeh:room-info-possibly-redacted

Conversation

@zecakeh
Copy link
Collaborator

@zecakeh zecakeh commented Jan 30, 2026

We usually don't care if the event was redacted or not, we usually want to know whether a field is set or not, so we don't need Original and Redacted variants.

This simplifies several parts of the code since we don't have to handle the intermediate enum to access the content now. Due to new APIs in Ruma we can also just convert original and redacted event contents to possibly redacted event contents.

This should allow further code removal in a follow-up PR, by allowing to use the same code to handle Sync* and Stripped* events in RoomInfo.

The backwards-compatible deserialization of MinimalStateEvent was verified in a client with Fractal.

@zecakeh zecakeh requested a review from a team as a code owner January 30, 2026 10:36
@zecakeh zecakeh requested review from poljar and removed request for a team January 30, 2026 10:36
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 79.83871% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.90%. Comparing base (87ce49e) to head (e5005b7).
⚠️ Report is 90 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk-base/src/utils.rs 80.00% 13 Missing ⚠️
crates/matrix-sdk-base/src/room/room_info.rs 85.71% 4 Missing and 1 partial ⚠️
crates/matrix-sdk-base/src/room/create.rs 0.00% 4 Missing ⚠️
...x-sdk-base/src/response_processors/state_events.rs 0.00% 0 Missing and 1 partial ⚠️
crates/matrix-sdk-base/src/room/tombstone.rs 75.00% 0 Missing and 1 partial ⚠️
crates/matrix-sdk-base/src/store/ambiguity_map.rs 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6088      +/-   ##
==========================================
+ Coverage   89.83%   89.90%   +0.06%     
==========================================
  Files         360      360              
  Lines       99873    99789      -84     
  Branches    99873    99789      -84     
==========================================
- Hits        89723    89712      -11     
+ Misses       6641     6575      -66     
+ Partials     3509     3502       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 30, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing zecakeh:room-info-possibly-redacted (e5005b7) with main (911b559)

Summary

✅ 50 untouched benchmarks

@zecakeh zecakeh force-pushed the room-info-possibly-redacted branch from f955c94 to 2989dfe Compare January 30, 2026 15:46
#[serde(
bound(serialize = "C: Serialize + Clone"),
from = "MinimalStateEventSerdeHelper<C>",
into = "MinimalStateEventSerdeHelper<C>"
Copy link
Collaborator Author

@zecakeh zecakeh Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I would have preferred to be able to serialize this directly without a tag, but for some reason applying #[serde(untagged)] on a variant of the deserialization helper makes the deserialization of the join rules content fail.

…lStateEvent

We usually don't care if the event was redacted or not, we usually want
to no whether a field is set or not, so we don't need `Original` and
`Redacted` variants.

This simplifies several parts of the code since we don't have to handle
the intermediate enum to access the content now. Due to new APIs in
Ruma we can also just convert original and redacted event contents to
possibly redacted event contents.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh force-pushed the room-info-possibly-redacted branch from 2989dfe to e5005b7 Compare January 30, 2026 16:01
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand this looks good.

@poljar poljar merged commit 9ad7cf9 into matrix-org:main Feb 5, 2026
53 checks passed
@zecakeh zecakeh deleted the room-info-possibly-redacted branch February 5, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants